package com.hepinghospital.user.adapter

import android.annotation.SuppressLint
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.hepinghospital.user.R
import com.rest.response.NursingProjectResponse
import jz.joyoung.robot.util.UtilString

/**
 * @Description: 护理预约项目列表适配器
 * @Author: lzp
 * @CreateDate: 2022/3/9 15:01
 * @UpdateRemark: 更新说明
 */
class AppointProjectAdapter(data: MutableList<NursingProjectResponse.ChargeItemsBean>) : BaseQuickAdapter<NursingProjectResponse.ChargeItemsBean, BaseViewHolder>(R.layout.item_nursing_project, data) {

    @SuppressLint("SetTextI18n")
    override fun convert(holder: BaseViewHolder, item: NursingProjectResponse.ChargeItemsBean) {
        holder.getView<TextView>(R.id.tv_title).text = item.chargeItemName
//        holder.getView<TextView>(R.id.tv_title).text = item.chargeItemName.substring(0, item.chargeItemName.indexOf("（"))
//        holder.getView<TextView>(R.id.tv_subtitle).text = item.chargeItemName.substring(item.chargeItemName.indexOf("（") + 1, item.chargeItemName.length - 1)
        holder.getView<TextView>(R.id.tv_price).text = "${UtilString.stringToDouble(item.price)}元"
        holder.getView<TextView>(R.id.tv_unit).text = " / ${item.unit}起"
    }
}